/*
*********************************************************************************************************
*	模块名称 : BSP模块
*********************************************************************************************************
*/

#ifndef _BSP_ADC_TP_H_
#define _BSP_ADC_TP_H_

#include <stdint.h>

#ifdef __cplusplus
extern "C"
{
#endif

	typedef union
	{
		uint32_t val;
		struct
		{
			int16_t x;
			int16_t y;
		} xy;
	} tp_pos_type;

	typedef struct
	{
		// isr handle
		uint16_t xv[4], yv[4], z1v[4], z2v[4];
		uint32_t xn_sel, yn_sel;
		uint32_t z1_sel, z2_sel;
		uint32_t tout_cnt;
		uint8_t step;
		uint8_t vindex;
		volatile uint8_t mend;

		// data handle
		uint8_t act_cnt;
		uint8_t rel_cnt;
		tp_pos_type adv;
		volatile tp_pos_type pos;
	} tp_adc_type;

	extern tp_adc_type tp;

#ifdef __cplusplus
}
#endif

/*******************************************************************************
 * BSP
 *******************************************************************************/

#endif
